package br.com.deployment.mobile;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;

public class NewEyre extends Activity {

	private String[] notaryOffice = new String[] { "Cartório Almendra",
			"Cartório B", "Cartório E", "Cartório C", "Cartório D",
			"Cartório X", "Cartório A", "Cartório Z", };

	private String[] city = new String[] { "Parnaíba", "Teresina", "Buriti", };

	private String[] questionnaire = new String[] { "Form1", "Form2", "Form3",
			"Form4", };

	private Spinner spinnerNotaryOffice;
	private Spinner spinnerCityNotaryOffice;

	private Spinner spinnerQuestionnaire;

	private Button initialEyre;

	OnClickListener buttonListener = new OnClickListener() {
		@Override
		public void onClick(View v) {
			Intent intent = new Intent(NewEyre.this, GenerateQuestionaire.class);
			//TODO Colocar id da correição
			intent.putExtra("id", "1");
			startActivity(intent);
		}
	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_new_eyre);

		spinnerNotaryOffice = (Spinner) findViewById(R.id.spinnerNotaryOffice);
		ArrayAdapter<String> adapterNotaryOffice = new ArrayAdapter<String>(
				getBaseContext(), android.R.layout.simple_spinner_item,
				notaryOffice);
		adapterNotaryOffice
				.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinnerNotaryOffice.setAdapter(adapterNotaryOffice);

		spinnerCityNotaryOffice = (Spinner) findViewById(R.id.spinnerCityNotaryOffice);
		ArrayAdapter<String> adapterCity = new ArrayAdapter<String>(
				getBaseContext(), android.R.layout.simple_spinner_item, city);
		adapterCity
				.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinnerCityNotaryOffice.setAdapter(adapterCity);

		spinnerQuestionnaire = (Spinner) findViewById(R.id.spinner_questionnaire);
		ArrayAdapter<String> adapterQuestionnaire = new ArrayAdapter<String>(
				getBaseContext(), android.R.layout.simple_spinner_item,
				questionnaire);
		adapterQuestionnaire
				.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinnerQuestionnaire.setAdapter(adapterQuestionnaire);

		initialEyre = (Button) findViewById(R.id.initial_eyre_button);
		initialEyre.setOnClickListener(buttonListener);

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_new_eyre, menu);
		return true;
	}

}
